﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MySql.Data.MySqlClient;

namespace Serialportsimulator
{
    class DAO
    {
        MySqlConnection conn;
        public DAO()
        {

        }

        public bool SaveRecord(string text)
        {
            string connstr = "data source=localhost;database=serial;user=root;charset=utf8";
            MySqlConnection conn = new MySqlConnection(connstr);
            string sql3 = String.Format("insert into serial_data (DATA) values ('{0}')", text);
            try
            {
                MySqlCommand cmd3 = new MySqlCommand(sql3, conn);
                conn.Open();
                int s = cmd3.ExecuteNonQuery();
                conn.Close();
            }
            catch (System.Exception)
            {
                return false;
            }
            

            return true;
        }


    }
}
